class GsclassesController < ApplicationController
  # GET /gsclasses
  # GET /gsclasses.xml
  def index
    @gsclasses = Gsclass.find(:all).sort_by{ |i| i[:name] }
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @gsclasses }
    end
  end

  # GET /gsclasses/1
  # GET /gsclasses/1.xml
  def show
    @gsclass = Gsclass.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @gsclass }
    end
  end

  # GET /gsclasses/new
  # GET /gsclasses/new.xml
  def new
    @gsclass = Gsclass.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @gsclass }
    end
  end

  # GET /gsclasses/1/edit
  def edit
    @gsclass = Gsclass.find(params[:id])
  end

  # POST /gsclasses
  # POST /gsclasses.xml
  def create
    @gsclass = Gsclass.new(params[:gsclass])

    respond_to do |format|
      if @gsclass.save
        flash[:notice] = 'Gsclass was successfully created.'
        format.html { redirect_to(@gsclass) }
        format.xml  { render :xml => @gsclass, :status => :created, :location => @gsclass }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @gsclass.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /gsclasses/1
  # PUT /gsclasses/1.xml
  def update
    @gsclass = Gsclass.find(params[:id])

    respond_to do |format|
      if @gsclass.update_attributes(params[:gsclass])
        flash[:notice] = 'Gsclass was successfully updated.'
        format.html { redirect_to(@gsclass) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @gsclass.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /gsclasses/1
  # DELETE /gsclasses/1.xml
  def destroy
    @gsclass = Gsclass.find(params[:id])
    @gsclass.destroy

    respond_to do |format|
      format.html { redirect_to(gsclasses_url) }
      format.xml  { head :ok }
    end
  end
end
